Some embodiments relate to executing and optimizing queries executed by database management systems. In particular, some embodiments concern methods and systems for optimizing the queries by providing cardinality estimations with guaranteed bounded error in a database management system in an efficient and effective manner. In some aspects, the data structures used to derive the estimates exploit discrete dense domains for faster histogram construction.